<template>
  <page-container :showBreadcrumb="false">
    <template #content>
      <div class="page-header-content">
        <div class="avatar">
          <a-avatar size="large" :src="currentUser.avatar" />
        </div>
        <div class="content">
          <div class="content-title">
            {{ currentUser.nickname }}
            <span class="welcome-text">，祝你开心每一天！</span>
          </div>
          <a-button @click="backStageManagement">控制台</a-button>
          <div class="pb10">{{ currentUser.extra.group }}</div>
        </div>
      </div>
    </template>
    <template #extraContent>
      <!-- <div class="extra-content">
        <div class="stat-item">
          <a-statistic title="项目数" :value="56" />
        </div>
        <div class="stat-item">
          <a-statistic title="团队内排名" :value="8" suffix="/ 24" />
        </div>
        <div class="stat-item">
          <a-statistic title="项目访问" :value="2223" />
        </div>
      </div> -->
    </template>
    <div></div>
  </page-container>
</template>

<script lang="ts">
import { defineComponent, computed } from 'vue';
import { useStore } from 'vuex';
import { STORAGE_TOKEN_KEY } from '@/store/mutation-type';
import ls from '@/utils/local-storage';

export default defineComponent({
  setup() {
    const store = useStore();
    // 跳转后台管理系统
    const backStageManagement = () => {
      const token = ls.get(STORAGE_TOKEN_KEY);
      const url = `${(window as any).g.consoleUrl}?token=${token}`;
      console.log(url);
      window.open(url, '_blank');
    };

    return {
      currentUser: computed(() => store.getters[`user/currentUser`]),
      backStageManagement,
    };
  },
  components: {},
});
</script>

<style lang="less" scoped>
@import './index.less';
</style>
